-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(brew-bump.sh): add checks and handle errors #4236
Conversation
Codecov Report
@@ Coverage Diff @@
## main #4236 +/- ##
=======================================
Coverage 65.09% 65.09%
=======================================
Files 36 36
Lines 1882 1882
Branches 380 380
=======================================
Hits 1225 1225
Misses 559 559
Partials 98 98 Continue to review full report at Codecov.
|
✨ Coder.com for PR #4236 deployed! It will be updated on every commit.
|
b590dcd
to
9aac550
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left some really minor suggestions for your consideration, this is good-to-go as it is
test/scripts/steps-lib.bats
Outdated
|
||
@test "is_env_var_set should return 1 if env var is not set" { | ||
run is_env_var_set "ASDF_TEST_SET" | ||
[ "$output" = 1 ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you change the functions to return stuff instead of echo, then you'd have to change this to check the $status
instead of $output
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! Okay if/after I refactor, I'll update these!
feat(script): add steps-lib, is_env_var_set & test feat(brew-bump): add check for VERSION feat(brew-bump): check HOMEBREW_GITHUB_API_TOKEN feat(steps-lib): add directory_exists helper fn fix(brew-bump): check that git clone worked feat(brew-bump): add check for remote upstream fix: remove upstream command thing feat(steps-lib): add file_exists helper function feat(brew-bump): add check for git-askpass.sh feat(steps-lib): add is_executable function & test feat(brew-bump): add check for is_executable refactor: use GIT_ASKPASS as variable
9aac550
to
8ef950a
Compare
This PR adds a lot of bash helper functions (+ tests) used in
brew-bump.sh
in order to ensure this script doesn't fail when publishing a release.TODOs
steps-lib.sh
$VERSION
cdr/ci/homebrew
$HOMEBREW_GITHUB_API_TOKEN
git-ask-pass.sh
GIT_ASKPASS
in isolated environmentFixes #3962
Test Plan
To test out the other parts of the script (specifically
GIT_ASKPASS
), here is what I did:https://master.cdr.dev/workspaces
brew-bump.sh
and addsteps-lib.sh
to Workspace.chmod +x test-brew.sh
VERSION="1.2.3" HOMEBREW_GITHUB_API_TOKEN="<redcated>" ./test-brew.sh
(make sure the token hadrepo
andworkflow
in scope).Notes
Ran into issues with scripts that used
set -u
so that's why I created a new file calledsteps-lib.sh
.See: sstephenson/bats#171